<extend name="Config/base"/>

<block name="body">

<div id="center">
<div id="center_base" class="with-padding" style="padding: 20px">

    <h2>
        修改密码
    </h2>
    <div class="row">
        <div class="col-md-8">
            <form id="changePasswordForm"  action="{:U('Ucenter/Config/doChangePassword')}" method="post" class="ajax-form form-horizontal">
                <div class="form-group">
                    <label for="inputOldPassword" class="col-sm-2 control-label">旧密码</label>

                    <div class="col-sm-10">
                        <input type="password" class="form-control" id="inputOldPassword" value="" name="old_password" placeholder="输入旧密码">
                    </div>
                </div>

                <div class="form-group">
                    <label for="inputNewPassword" class="col-sm-2 control-label">新密码</label>

                    <div class="col-sm-10">
                        <input type="password" class="form-control" id="inputNewPassword" value="" name="new_password" placeholder="输入新密码">
                    </div>
                </div>

                <div class="form-group">
                    <label for="inputConfirmPassword" class="col-sm-2 control-label">确认密码</label>

                    <div class="col-sm-10">
                        <input type="password" class="form-control" id="inputConfirmPassword" value="" name="confirm_password"" placeholder="输入确认密码">
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <p class="text-danger" id="submitTip"></p>
                        <button type="submit" class="btn btn-primary">保存</button>
                    </div>
                </div>
            </form>
        </div>
    </div>


    <block name="script">
        <script>
            //检查两次输入的密码是否一致
            $(function(){
                $('#changePasswordForm').submit(function(e){
                    var newPassword = $('#inputNewPassword').val();
                    var confirmPassword = $('#inputConfirmPassword').val();
                    if(newPassword != confirmPassword) {
                        toast.error('两次输入的密码不一致');
                        e.stopPropagation();
                        return false;
                    }
                })
            })
        </script>
    </block>
</div>
</div>

</block>